
var Main = require("Main");
cc.Class({
    extends: cc.Component,

    properties: {

    },



    onLoad() {
        this.mousePos0 = null;//初始位置
        this.out = false;//用于判断物体是否移除
        this.isDrag = false;//判断物体是否是拖拽状态
        this.only = true;//拖拽过程中 只判断一次物体状态
        this.puzzleBG = [];//拼图背景组成的数组
        this.disArray = [];//移出后松手时，每个背景距离物体的距离组成的数组
        this.disArrayFriend = [];
        this.startpos = [];//所有物体的初始位置组成的数组
        this.isHave = cc.find("Canvas").getComponent(Main).isHave;//关联脚本
        this.startpuzzle = [];/*cc.find("Canvas").getComponent(Main).startpuzzle;*/
       // console.log("startpuzzle init");
        this.BGisHave = cc.find("Canvas").getComponent(Main).BGisHave;
        this.index = 1;//索引，用于判断松手后，物体的位置
        this.indexFriend = 1;
        this.minIndex = 0;
        this.minIndexFriend = 0;
        this.once = true;
        this.haveBig = false;
        this.isfind = false;
        this.letgo = true;
        this.width = 3;
        this.height = 3;
        this.name = "";
        this.BGW = 0;
        this.BGH = 0;
        this.BGWFriend = 0;
        this.BGHFriend = 0;
        this.distance = 0;
        this.poschangedelaytime = 0;
        this.AllCorrectArray = cc.find("Canvas").getComponent(Main).AllCorrectArray;;
        this.correctArray = cc.find("Canvas").getComponent(Main).correctArray;;
        this.content = cc.find("Canvas/PuzzleChooseScrollView/view/content");

        var self = this;

        // console.log(cc.find("Canvas/PuzzleBG").getChildren().length);
        // for (let i = 0; i < cc.find("Canvas/PuzzleBG").getChildren().length; i++) {
        //     this.puzzleBG.push(cc.find("Canvas/PuzzleBG").getChildren()[i]);

        // }

        for (let i = 0; i < (cc.find("Canvas").getComponent(Main).row + 1) * (cc.find("Canvas").getComponent(Main).colum); i++) {
            self.startpos.push(cc.v2(-3900 + 200 * i, -120));
        }
        this.content.width = (cc.find("Canvas").getComponent(Main).row + 1) * (cc.find("Canvas").getComponent(Main).colum) * 200;



        this.node.on(cc.Node.EventType.TOUCH_START, function (event) {
            self.mousePos0 = event.getLocation();

        }, this.node);
        this.node.on(cc.Node.EventType.TOUCH_MOVE, function (event) {
            if (self.out) {
                cc.find("Canvas/PuzzleChooseScrollView").getComponent(cc.ScrollView).enabled = false;
                var delta = event.touch.getDelta();
                self.only = false;
                this.opacity = 255;
                this.x += delta.x;
                this.y += delta.y;
            } else {
                var delta = event.touch.getDelta();

                if (self.only) {

                    if (Math.abs(delta.y / delta.x) < 1) {
                        // self.isDrag = false;
                    }
                    else {
                        self.isDrag = true;
                        //this.position = cc.find("Canvas/MovePart").convertToNodeSpaceAR(event.getLocation());
                    }
                }
                if (self.isDrag == true) {
                    cc.find("Canvas/PuzzleChooseScrollView").getComponent(cc.ScrollView).enabled = false;

                    self.only = false;
                    this.opacity = 255;
                    this.x += delta.x;
                    this.y += delta.y;
                }
                else {
                    self.only = false;
                    //  self.isSlide = true;
                    this.x += 0;
                    this.y += 0;
                }
            }
           // console.log(self.isDrag);
            if (self.isDrag == true) {
                //拖拽前后，下面方块的变化(不松手)

                if (self.AllCorrectArray.length > 0) {

                    //   var index = -1;
                    //遍历连接正确的数组，找到点击物体所在的数组
                    for (let i = 0; i < self.AllCorrectArray.length; i++) {
                        for (let j = 0; j < self.AllCorrectArray[i].length; j++) {
                            if (self.AllCorrectArray[i].indexOf(this) != -1 && j != self.AllCorrectArray[i].indexOf(this)) {
                                self.AllCorrectArray[i][j].x += delta.x;
                                self.AllCorrectArray[i][j].y += delta.y;

                            }
                        }
                        // if (index != -1) {
                        //     break;
                        // }
                    }

                    //找到以后，
                    // for (let i = 0; i < self.AllCorrectArray[index].length; i++) {
                    //     if (i == self.AllCorrectArray[index].indexOf(this)) {
                    //         continue;
                    //     }





                    //  console.log(self.AllCorrectArray[index][i].position);
                }



              //  console.log(self.AllCorrectArray);
                if (this.y >= 80) {


                    if (self.once == false) {
                        return;
                    }
                    self.once = false;
                    this.parent = cc.find("Canvas/MovePart");
                    this.position = cc.v2(this.position.x + cc.find("Canvas/PuzzleChooseScrollView/view/content").position.x, this.position.y);
                  //  console.log("向前移动");
                    for (let i = self.startpuzzle.indexOf(this) + 1; i < self.startpuzzle.length; i++) {
                        self.startpuzzle[i].stopAllActions();
                        var action = cc.moveTo(0.15, self.startpos[i - 1]);
                        self.startpuzzle[i].runAction(action);
                    }

                    self.isHave[self.startpuzzle.indexOf(this)] = true;
                    self.isHave[self.startpuzzle.length - 1] = false;
                    self.startpuzzle.splice(self.startpuzzle.indexOf(this), 1);

                   // console.log(self.isHave);
                   // console.log(self.startpuzzle);
                   // console.log("删一个");

                }
                else if (this.y < 80) {
                    for (let i = 0; i < self.AllCorrectArray.length; i++) {
                        for (let j = 0; j < self.AllCorrectArray[i].length; j++) {
                            if (self.AllCorrectArray[i].indexOf(this) != -1) {
                                return;
                            }
                        }
                    }

                    // if (self.once == true) {
                    //     return;
                    // }
                    // self.once = true;
                    var pos = this.parent.convertToWorldSpaceAR(this.position);
                    // console.log(pos);
                    if (self.once == false) {

                        self.once = true;
                        this.parent = cc.find("Canvas/PuzzleChooseScrollView/view/content");

                        this.position = cc.v2(this.position.x - cc.find("Canvas/PuzzleChooseScrollView/view/content").position.x, this.position.y);

                        for (let i = 0; i < self.startpuzzle.length; i++) {

                            if (self.startpuzzle[i].parent.convertToWorldSpaceAR(self.startpuzzle[i].position).x > pos.x) {

                                self.haveBig = true;
                                for (let j = i; j < self.startpuzzle.length; j++) {
                                    // self.startpuzzle[j].position = self.startpos[j + 1];
                                    self.startpuzzle[j].stopAllActions();
                                    var action = cc.moveTo(0.15, self.startpos[j + 1]);

                                    self.startpuzzle[j].runAction(action);

                                }

                                self.startpuzzle.splice(i, 0, this);

                                self.isHave[i] = false;
                                self.isHave[self.startpuzzle.length - 1] = true;
                               // console.log(self.isHave);
                               // console.log(self.startpuzzle);
                                break;
                            }

                        }


                        if (self.haveBig == false) {
                            self.startpuzzle.push(this);
                           // console.log(self.isHave);
                           // console.log(self.startpuzzle);
                        }


                    }
                    else {
                        this.parent = cc.find("Canvas/PuzzleChooseScrollView/view/content");

                        // this.position = cc.v2(this.position.x - cc.find("Canvas/PuzzleChooseScrollView/view/content").position.x, this.position.y);

                        if (self.startpuzzle.indexOf(this) != -1) {
                            self.isHave[self.startpuzzle.indexOf(this)] = false;
                        }

                        for (let i = 0; i < self.startpuzzle.length; i++) {
                            if (i == self.startpuzzle.indexOf(this)) {
                                continue;
                            }

                            if (Math.abs(pos.x - self.startpuzzle[i].parent.convertToWorldSpaceAR(self.startpuzzle[i].position).x) <= 10) {

                                for (let j = 0; j < self.isHave.length; j++) {
                                    if (self.isHave[j] == false) {
                                        self.startpuzzle[i].position = self.startpos[j];
                                        var bottle = null;

                                        self.isHave[self.startpuzzle.indexOf(this)] = true;
                                        self.isHave[self.startpuzzle.indexOf(self.startpuzzle[i])] = false;
                                        bottle = self.startpuzzle[self.startpuzzle.indexOf(this)];
                                        self.startpuzzle[self.startpuzzle.indexOf(this)] = self.startpuzzle[i];
                                        self.startpuzzle[i] = bottle;
                                      //  console.log(self.isHave);
                                      //  console.log(self.startpuzzle);
                                        break;
                                    }
                                }
                            }
                        }

                    }





                }
            }


        }, this.node);
        this.node.on(cc.Node.EventType.TOUCH_END, function (event) {



            var wssss = event.getLocation();

            var nodePos = cc.find("Canvas/PuzzleBG").convertToNodeSpaceAR(wssss);

           // console.log(nodePos);

            self.only = true;
            clearTimeout(self.poschangedelaytime);

            self.letgo = false;


            self.poschangedelaytime = setTimeout(() => {
                self.letgo = true;
            }, 160);

            if (Math.floor(self.mousePos0.x) == Math.floor(wssss.x) && Math.floor(self.mousePos0.y) == Math.floor(wssss.y)) {
                if (nodePos.x < -360 || nodePos.x > 360 || nodePos.y > 960 || nodePos.y < 0) {
                  //  console.log("rui了");
                    return;

                }
                if (this.parent == cc.find("Canvas/PuzzleChooseScrollView/view/content")) {
                    return;
                }

                this.rotation += 90;
               // console.log("转");
                if (self.AllCorrectArray.length > 0) {

                    var index = -1;
                    //遍历连接正确的数组，找到点击物体所在的数组
                    for (let i = 0; i < self.AllCorrectArray.length; i++) {
                        for (let j = 0; j < self.AllCorrectArray[i].length; j++) {
                            if (this == self.AllCorrectArray[i][j]) {
                                index = i;
                                break;
                            }
                        }
                        if (index != -1) {
                            break;
                        }
                    }
                    if (index != -1) {
                        //找到以后，
                        for (let i = 0; i < self.AllCorrectArray[index].length; i++) {
                            if (i == self.AllCorrectArray[index].indexOf(this)) {
                                continue;
                            }

                            self.distance = Math.sqrt((this.x - self.AllCorrectArray[index][i].x) * (this.x - self.AllCorrectArray[index][i].x) + (this.y - self.AllCorrectArray[index][i].y) * (this.y - self.AllCorrectArray[index][i].y))
                            if (self.AllCorrectArray[index][i].x >= this.x) {
                                self.AllCorrectArray[index][i].position = cc.v2(Math.cos(Math.asin((self.AllCorrectArray[index][i].y - this.y) / self.distance) - Math.PI / 2) * self.distance + this.x, Math.sin(Math.asin((self.AllCorrectArray[index][i].y - this.y) / self.distance) - Math.PI / 2) * self.distance + this.y);
                            }
                            else {
                                self.AllCorrectArray[index][i].position = cc.v2(Math.cos(- Math.asin((self.AllCorrectArray[index][i].y - this.y) / self.distance) + Math.PI / 2) * self.distance + this.x, Math.sin(-Math.asin((self.AllCorrectArray[index][i].y - this.y) / self.distance) + Math.PI / 2) * self.distance + this.y);
                            }

                            self.AllCorrectArray[index][i].rotation += 90;
                           // console.log(self.AllCorrectArray[index][i].position);
                        }
                    }




                }
            }



            cc.find("Canvas/PuzzleChooseScrollView").getComponent(cc.ScrollView).enabled = true;

            if (this.y >= 80) {

                self.up80(nodePos);



            }
            else if (this.y < 80) {
                var shoodreturn = false;
                for (let i = 0; i < self.AllCorrectArray.length; i++) {
                    for (let j = 0; j < self.AllCorrectArray[i].length; j++) {
                        if (self.AllCorrectArray[i].indexOf(this) != -1) {
                            shoodreturn = true;
                            self.up80(nodePos);
                            break;
                        }
                    }
                    if (shoodreturn) {
                        return;
                    }
                }

                self.out = false;



                for (let i = 0; i < self.isHave.length; i++) {
                    if (self.isHave[i] == false) {
                      //  console.log("动一动");
                        var action2 = cc.moveTo(0.1, self.startpos[i]);
                        this.runAction(action2);
                        self.isHave[i] = true;
                      //  console.log(self.isHave);
                      //  console.log(self.startpuzzle);
                        break;
                    }

                }

            }


        }, this.node);
        this.node.on(cc.Node.EventType.TOUCH_CANCEL, function (event) {

            var wssss = event.getLocation();
            self.only = true;

            // if (Math.floor(self.mousePos0.x) == Math.floor(wssss.x) && Math.floor(self.mousePos0.y) == Math.floor(wssss.y)) {

            //     this.rotation += 90;
            // }
            cc.find("Canvas/PuzzleChooseScrollView").getComponent(cc.ScrollView).enabled = true;
            // self.isDrag = false;

        }, this.node);

        this.node.on('position-changed', function () {
            self.posChange();
        }, this.node);
    },

    start() {

    },
    up80(nodePos) {
        var self = this;
        self.out = true;

      //  console.log("一上来进了吧");
        for (let i = 0; i < self.puzzleBG.length; i++) {
            var dis = Math.sqrt((nodePos.x - self.puzzleBG[i].x) * (nodePos.x - self.puzzleBG[i].x) + (nodePos.y - self.puzzleBG[i].y) * (nodePos.y - self.puzzleBG[i].y))
            self.disArray.push(dis);
        }
       // console.log(self.disArray);
        var min = self.disArray[0];
        for (; self.index < self.disArray.length; self.index++) {
            if (self.disArray[self.index] <= min) {
                min = self.disArray[self.index];
                self.minIndex = self.index;
            }
        }

        self.BGW = self.puzzleBG[self.minIndex].name[0];
        self.BGH = self.puzzleBG[self.minIndex].name[2];
       // console.log(self.BGW + self.BGH);

        var finishedMain = cc.callFunc(function (target) {
            self.JudgeIsHave(self.BGW, self.BGH);
        }, this)
        var actionMain = cc.moveTo(0.1, self.puzzleBG[self.minIndex]);
        var action2Main = cc.sequence(actionMain, finishedMain);
       // console.log(self.BGisHave);
        this.node.runAction(action2Main);
        var isFinded = false;
        for (let i = 0; i < self.AllCorrectArray.length; i++) {
            for (let j = 0; j < self.AllCorrectArray[i].length; j++) {
                if (self.AllCorrectArray[i].indexOf(this.node) != -1) {
                    isFinded = true;
                    if (j == self.AllCorrectArray[i].indexOf(this.node)) {
                        continue;
                    }
                    let comparePos = cc.v2((self.puzzleBG[self.minIndex].x) + (self.AllCorrectArray[i][j].x - this.node.x), (self.puzzleBG[self.minIndex].y) + (self.AllCorrectArray[i][j].y - this.node.y));
                    let action = cc.moveTo(0.1, comparePos);
                    let finished = cc.callFunc(function (target) {
                        //console.log("回调了");


                      //  console.log("小兄弟们一起判断");

                        // var nodePosFriend = cc.v2(nodePos.x + (self.AllCorrectArray[i][j].x - this.x), nodePos.y + (self.AllCorrectArray[i][j].y - this.y));
                        //var comparePos = cc.v2(targetPos.x + (self.AllCorrectArray[i][j].x - this.x), targetPos.y + (self.AllCorrectArray[i][j].y - this.y));
                        if (comparePos.x >= -360 && comparePos.x <= 360 && comparePos.y <= 960 && comparePos.y >= 0) {

                            for (let k = 0; k < self.puzzleBG.length; k++) {
                                var disFriend = Math.sqrt((comparePos.x - self.puzzleBG[k].x) * (comparePos.x - self.puzzleBG[k].x) + (comparePos.y - self.puzzleBG[k].y) * (comparePos.y - self.puzzleBG[k].y))
                                self.disArrayFriend.push(disFriend);
                            }
                            let min = self.disArrayFriend[0];
                            for (; self.indexFriend < self.disArrayFriend.length; self.indexFriend++) {
                                if (self.disArrayFriend[self.indexFriend] <= min) {
                                    min = self.disArrayFriend[self.indexFriend];
                                    self.minIndexFriend = self.indexFriend;
                                }
                            }

                            self.BGWFriend = self.puzzleBG[self.minIndexFriend].name[0];
                            self.BGHFriend = self.puzzleBG[self.minIndexFriend].name[2];
                         //  console.log(self.BGWFriend + self.BGHFriend);
                          //  console.log(self.AllCorrectArray);
                          //  console.log(i + ",," + j);
                            self.AllCorrectArray[i][j].getComponent("Drag").JudgeIsHave(self.BGWFriend, self.BGHFriend);
                          //  console.log("小兄弟进了");


                        }

                        self.disArrayFriend.splice(0, self.puzzleBG.length);
                        self.indexFriend = 1;
                        self.minIndexFriend = 0;


                    }, this);
                    var action2 = cc.sequence(action, finished);
                    self.AllCorrectArray[i][j].runAction(action2);

                }
            }
            if (isFinded == true) {
                break;
            }
        }


        self.disArray.splice(0, self.puzzleBG.length);
        self.index = 1;
        self.minIndex = 0;

    },
    posChange() {
        var self = this;
        if (self.letgo) {
            for (let i = 0; i < self.BGisHave.length; i++) {
                for (let j = 0; j < self.BGisHave[i].length; j++) {
                    for (let k = 0; k < self.BGisHave[i][j].length; k++) {
                        if (this.node == self.BGisHave[i][j][k]) {
                            self.BGisHave[i][j].pop(this.node);
                           // console.log("pop掉");
                          //  console.log(self.BGisHave);
                            self.isfind = true;
                            break;
                        }
                    }
                    if (self.isfind == true) {
                        break;
                    }
                }
                if (self.isfind == true) {
                    self.isfind = false;
                    break;
                }
            }
            //self.letgo = false;
        }
    },
    JudgeIsHave(BGW, BGH) {
      //  console.log(this.node.name + "判断");
        var self = this;
        //  if (friendisin) {

        if (self.BGisHave[BGW - 1][BGH - 1].indexOf(this.node) == -1) {
            self.BGisHave[BGW - 1][BGH - 1].push(this.node);
           // console.log("push了");
           // console.log(self.BGisHave);
        }
      //  console.log(BGW + BGH);
        //  }

        //判断周围的拼图是不是需要的(左下角)
        if (BGW == 1 && BGH == 1) {
          //  console.log("没错 就是我");
            //0度
            if (this.node.rotation % 360 == 0) {
              //  console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                  //  console.log("有人");

                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                      //  console.log(this.node);
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                          //  console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 0) {
                             //   console.log("又对了兄弟");
                                // var isHaveArray = false;
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                  //  console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                   // console.log(arrayIndex);
                                    var complete = false;

                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                       // console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                         //   console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                 //   console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                     //   console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                               // console.log(self.AllCorrectArray);
                            }
                            // if (self.AllCorrectArray[k][j] == this.node) {
                            //     if (self.AllCorrectArray[k].indexOf(self.BGisHave[BGW][BGH - 1][i]) == -1) {

                            //         for (let kk = 0; kk < self.AllCorrectArray[k].length; kk++) {
                            //             if (self.AllCorrectArray[kk].indexOf(self.BGisHave[BGW][BGH - 1][i]) != -1) {
                            //                 for (let jj = 0; jj < self.AllCorrectArray[kk].length; jj++) {
                            //                     if (self.AllCorrectArray[k].indexOf(self.AllCorrectArray[kk][jj]) == -1) {
                            //                         self.AllCorrectArray[k].push(self.AllCorrectArray[kk][jj]);
                            //                     }


                            //                 }
                            //                 self.AllCorrectArray[kk].splice(0, self.AllCorrectArray[kk].length);
                            //             }
                            //         }


                            //     }
                            //     //  isHaveArray = true;
                            // }


                            // var count = self.AllCorrectArray.length - 1;
                            // for (let kk = 0; kk < count; kk++) {
                            //     for (let jj = 0; jj < count; jj++) {
                            //         if (kk == jj) {
                            //             continue;
                            //         }
                            //         for (let ii = 0; ii < self.AllCorrectArray[jj].length; ii++) {
                            //             if (self.AllCorrectArray[kk].indexOf(self.AllCorrectArray[jj][ii]) != -1) {
                            //                 for (let mm = 0; mm < self.AllCorrectArray[jj].length; mm++) {
                            //                     if (self.AllCorrectArray[kk].indexOf(self.AllCorrectArray[jj][mm]) == -1) {
                            //                         self.AllCorrectArray[kk].push(self.AllCorrectArray[jj][mm]);
                            //                         console.log("融合了");
                            //                     }
                            //                 }
                            //                 self.AllCorrectArray[jj].splice(0, self.AllCorrectArray[jj].length);
                            //                 break;
                            //             }
                            //         }

                            //     }
                            // }

                            // if (isHaveArray == false) {
                            //     self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                            // }



                            break;
                        }
                    }
                }
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                  //  console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                           // console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                     //   console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                        //    console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                  //  console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                      //  console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                               // console.log(self.AllCorrectArray);
                            }
                            // var count = self.AllCorrectArray.length - 1;
                            // for (let kk = 0; kk < count; kk++) {
                            //     for (let jj = 0; jj < count; jj++) {
                            //         if (kk == jj) {
                            //             continue;
                            //         }
                            //         for (let ii = 0; ii < self.AllCorrectArray[jj].length; ii++) {
                            //             if (self.AllCorrectArray[kk].indexOf(self.AllCorrectArray[jj][ii]) != -1) {
                            //                 for (let mm = 0; mm < self.AllCorrectArray[jj].length; mm++) {
                            //                     if (self.AllCorrectArray[kk].indexOf(self.AllCorrectArray[jj][mm]) == -1) {
                            //                         self.AllCorrectArray[kk].push(self.AllCorrectArray[jj][mm]);
                            //                         console.log("you融合了");
                            //                     }
                            //                 }
                            //                 self.AllCorrectArray[jj].splice(0, self.AllCorrectArray[jj].length);
                            //                 break;
                            //             }
                            //         }

                            //     }
                            // }
                            // if (isHaveArray == false) {
                            //     self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                            // }



                            break;
                        }

                    }

                }

            }
            //90度
            else if (this.node.rotation % 360 == 90) {
               // console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                  //  console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                      //  console.log(this.node);
                       // console.log(self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string);
                        //console.log()
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == this.node.getChildByName("New Label").getComponent(cc.Label).string[0] + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                          //  console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 90) {
                              //  console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                   // console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                   // console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                      //  console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                          //  console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                  //  console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                       // console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                //console.log(self.AllCorrectArray);
                            }

                            break;
                        }
                    }
                }
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                  //  console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                      //  console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                         //   console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 90) {
                              //  console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                              //  console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                      //  console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                          //  console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                  //  console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                      //  console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                              //  console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }

            }
            //180度
            else if (this.node.rotation % 360 == 180) {
               // console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }
                    }
                }
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }
            }
            //270度
            else if (this.node.rotation % 360 == 270) {
                console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                        console.log(this.node);
                        console.log(self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string);
                        //console.log()
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == this.node.getChildByName("New Label").getComponent(cc.Label).string[0] + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }
                    }
                }
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }
            }
        }
        //判断周围的拼图是不是需要的(左侧一列)
        for (let i = 1; i < self.height - 1; i++) {
            if (BGW == i + 1 && BGH == 1) {
                //0度
                if (this.node.rotation % 360 == 0) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }

                                break;
                            }
                        }
                    }
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }

                                break;
                            }

                        }

                    }

                }
                //90度
                else if (this.node.rotation % 360 == 90) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            console.log(self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string);
                            //console.log()
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == this.node.getChildByName("New Label").getComponent(cc.Label).string[0] + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }
                        }
                    }
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }

                                break;
                            }

                        }

                    }

                }
                //180度
                else if (this.node.rotation % 360 == 180) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }
                        }
                    }
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }

                                break;
                            }

                        }

                    }
                }
                //270度
                else if (this.node.rotation % 360 == 270) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            console.log(self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string);
                            //console.log()
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == this.node.getChildByName("New Label").getComponent(cc.Label).string[0] + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }
                        }
                    }
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                }
            }
        }
        //判断周围的拼图是不是需要的(左上角)
        if (BGW == self.height && BGH == 1) {
            //0度
            if (this.node.rotation % 360 == 0) {
                console.log("角度对的");
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }

            }
            //90度
            else if (this.node.rotation % 360 == 90) {
                console.log("角度对的");
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 90) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 90) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }

            }
            //180度
            else if (this.node.rotation % 360 == 180) {
                console.log("角度对的");
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }
            }
            //270度
            else if (this.node.rotation % 360 == 270) {
                console.log("角度对的");
                //右面那块有东西
                if (self.BGisHave[BGW - 1][BGH].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                console.log(self.AllCorrectArray);
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        console.log("awwaa,," + this.node.name);
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);
                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }


                            break;
                        }

                    }

                }
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }

                            break;
                        }

                    }

                }
            }
        }
        //判断周围的拼图是不是需要的(上面一行)
        for (let i = 1; i < self.width - 1; i++) {
            if (BGW == self.height && BGH == i + 1) {
                //0度
                if (this.node.rotation % 360 == 0) {
                    console.log("角度对的");
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }

                }
                //90度
                else if (this.node.rotation % 360 == 90) {
                    console.log("角度对的");
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }

                }
                //180度
                else if (this.node.rotation % 360 == 180) {
                    console.log("角度对的");
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }
                }
                //270度
                else if (this.node.rotation % 360 == 270) {
                    console.log("角度对的");
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }

                                break;
                            }

                        }

                    }
                }
            }
        }
        //判断周围的拼图是不是需要的(右上角)
        if (BGW == self.height && BGH == self.width) {
            //0度
            if (this.node.rotation % 360 == 0) {
                console.log("角度对的");
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }




                            break;
                        }

                    }

                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }

            }
            //90度
            else if (this.node.rotation % 360 == 90) {
                console.log("角度对的");
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 90) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }




                            break;
                        }

                    }

                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }

            }
            //180度
            else if (this.node.rotation % 360 == 180) {
                console.log("角度对的");
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }




                            break;
                        }

                    }

                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }
            }
            //270度
            else if (this.node.rotation % 360 == 270) {
                console.log("角度对的");
                //下面那块有东西
                if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }




                            break;
                        }

                    }

                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }
            }
        }
        //判断周围的拼图是不是需要的(右侧一列)
        for (let i = 1; i < self.height - 1; i++) {
            if (BGW == i + 1 && BGH == self.width) {
                //0度
                if (this.node.rotation % 360 == 0) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }
                        }
                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }

                }
                //90度
                else if (this.node.rotation % 360 == 90) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }
                        }
                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }




                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }

                }
                //180度
                else if (this.node.rotation % 360 == 180) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }
                        }
                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }
                }
                //270度
                else if (this.node.rotation % 360 == 270) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }
                        }
                    }
                    //下面那块有东西
                    if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }




                                break;
                            }

                        }

                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }
                }
            }
        }
        //判断周围的拼图是不是需要的(右下角)
        if (BGW == 1 && BGH == self.width) {
            //0度
            if (this.node.rotation % 360 == 0) {
                console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                    console.log("有人");

                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }



                            break;
                        }
                    }
                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }

            }
            //90度
            else if (this.node.rotation % 360 == 90) {
                console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                    console.log("有人");

                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 90) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }



                            break;
                        }
                    }
                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }

            }
            //180度
            else if (this.node.rotation % 360 == 180) {
                console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                    console.log("有人");

                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }



                            break;
                        }
                    }
                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 180) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }
            }
            //270度
            else if (this.node.rotation % 360 == 270) {
                console.log("角度对的");
                //上面那块有东西
                if (self.BGisHave[BGW][BGH - 1].length > 0) {
                    console.log("有人");

                    for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }



                            break;
                        }
                    }
                }
                //左面那块有东西
                if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                    console.log("有人");
                    for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                        console.log(this.node);
                        if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                            console.log("对的人");
                            if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 270) {
                                console.log("又对了兄弟");
                                var targetIn = false;
                                var targetAround = false;
                                for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                    for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                        if (self.AllCorrectArray[k][j] == this.node) {
                                            targetIn = true;
                                        }

                                        if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                            targetAround = true;
                                        }

                                    }
                                }
                                if (targetIn == false && targetAround == false) {
                                    self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                }
                                else if (targetIn == false && targetAround == true) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                self.AllCorrectArray[k].push(this.node);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == false) {
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                break;
                                            }
                                        }

                                    }
                                }
                                else if (targetIn == true && targetAround == true) {
                                    console.log("全有小兄弟");
                                    var arrayIndex = 0;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                arrayIndex = k;
                                            }
                                        }

                                    }
                                    console.log(arrayIndex);
                                    var complete = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        console.log("awwaa,," + this.node.name);
                                        if (k == arrayIndex) {
                                            continue;
                                        }
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                            console.log("sdfvvvv,," + this.node.name);

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                    console.log("ssccbttt,," + this.node.name);
                                                    if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                        self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                        console.log(self.AllCorrectArray[arrayIndex]);
                                                    }
                                                }
                                                complete = true;
                                                setTimeout(() => {
                                                    self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                }, 200);

                                                break;
                                            }

                                        }
                                        if (complete) {
                                            break;
                                        }

                                    }

                                }
                                console.log(self.AllCorrectArray);
                            }
                            break;
                        }

                    }

                }
            }
        }
        //判断周围的拼图是不是需要的(下面一行)
        for (let i = 1; i < self.width - 1; i++) {
            if (BGW == 1 && BGH == i + 1) {
                //0度
                if (this.node.rotation % 360 == 0) {
                    console.log("角度对的");
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }
                        }
                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }

                        }

                    }

                }
                //90度
                else if (this.node.rotation % 360 == 90) {
                    console.log("角度对的");
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 90) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }
                        }
                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }

                }
                //180度
                else if (this.node.rotation % 360 == 180) {
                    console.log("角度对的");
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }
                        }
                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 180) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }
                }
                //270度
                else if (this.node.rotation % 360 == 270) {
                    console.log("角度对的");
                    //右面那块有东西
                    if (self.BGisHave[BGW - 1][BGH].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    console.log(self.AllCorrectArray);
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            console.log("awwaa,," + this.node.name);
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);
                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }


                                break;
                            }

                        }

                    }
                    //上面那块有东西
                    if (self.BGisHave[BGW][BGH - 1].length > 0) {
                        console.log("有人");

                        for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }



                                break;
                            }
                        }
                    }
                    //左面那块有东西
                    if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                        console.log("有人");
                        for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                            console.log(this.node);
                            if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                console.log("对的人");
                                if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 270) {
                                    console.log("又对了兄弟");
                                    var targetIn = false;
                                    var targetAround = false;
                                    for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                        for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                            if (self.AllCorrectArray[k][j] == this.node) {
                                                targetIn = true;
                                            }

                                            if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                targetAround = true;
                                            }

                                        }
                                    }
                                    if (targetIn == false && targetAround == false) {
                                        self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                    }
                                    else if (targetIn == false && targetAround == true) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    self.AllCorrectArray[k].push(this.node);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == false) {
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                    break;
                                                }
                                            }

                                        }
                                    }
                                    else if (targetIn == true && targetAround == true) {
                                        console.log("全有小兄弟");
                                        var arrayIndex = 0;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    arrayIndex = k;
                                                }
                                            }

                                        }
                                        console.log(arrayIndex);
                                        var complete = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            console.log("awwaa,," + this.node.name);
                                            if (k == arrayIndex) {
                                                continue;
                                            }
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                console.log("sdfvvvv,," + this.node.name);

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                    for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                        console.log("ssccbttt,," + this.node.name);
                                                        if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                            self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                            console.log(self.AllCorrectArray[arrayIndex]);
                                                        }
                                                    }
                                                    complete = true;
                                                    setTimeout(() => {
                                                        self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                    }, 200);

                                                    break;
                                                }

                                            }
                                            if (complete) {
                                                break;
                                            }

                                        }

                                    }
                                    console.log(self.AllCorrectArray);
                                }
                                break;
                            }

                        }

                    }
                }
            }
        }
        //判断周围的拼图是不是需要的(所有中间的)
        for (let i = 1; i < self.height - 1; i++) {
            for (let j = 1; j < self.width - 1; j++) {
                if (BGW == i + 1 && BGH == j + 1) {
                    //0度
                    if (this.node.rotation % 360 == 0) {
                        console.log("角度对的");
                        //上面那块有东西
                        if (self.BGisHave[BGW][BGH - 1].length > 0) {
                            console.log("有人");

                            for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 0) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }


                                    break;
                                }
                            }
                        }
                        //下面那块有东西
                        if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 0) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }



                                    break;
                                }

                            }

                        }
                        //左面那块有东西
                        if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }
                                    break;
                                }

                            }

                        }
                        //右面那块有东西
                        if (self.BGisHave[BGW - 1][BGH].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 0) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        console.log(self.AllCorrectArray);
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                console.log("awwaa,," + this.node.name);
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);
                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }

                                    break;
                                }

                            }

                        }

                    }
                    //90度
                    else if (this.node.rotation % 360 == 90) {
                        console.log("角度对的");
                        //下面那块有东西
                        if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 90) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }



                                    break;
                                }

                            }

                        }
                        //右面那块有东西
                        if (self.BGisHave[BGW - 1][BGH].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 90) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        console.log(self.AllCorrectArray);
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                console.log("awwaa,," + this.node.name);
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);
                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }

                                    break;
                                }

                            }

                        }
                        //上面那块有东西
                        if (self.BGisHave[BGW][BGH - 1].length > 0) {
                            console.log("有人");

                            for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 90) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }


                                    break;
                                }
                            }
                        }
                        //左面那块有东西
                        if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 0) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }
                                    break;
                                }

                            }

                        }

                    }
                    //180度
                    else if (this.node.rotation % 360 == 180) {
                        console.log("角度对的");
                        //下面那块有东西
                        if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 180) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }



                                    break;
                                }

                            }

                        }
                        //右面那块有东西
                        if (self.BGisHave[BGW - 1][BGH].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 180) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        console.log(self.AllCorrectArray);
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                console.log("awwaa,," + this.node.name);
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);
                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }


                                    break;
                                }

                            }

                        }
                        //上面那块有东西
                        if (self.BGisHave[BGW][BGH - 1].length > 0) {
                            console.log("有人");

                            for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 180) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }

                                    break;
                                }
                            }
                        }
                        //左面那块有东西
                        if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 180) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }
                                    break;
                                }

                            }

                        }
                    }
                    //270度
                    else if (this.node.rotation % 360 == 270) {
                        console.log("角度对的");
                        //下面那块有东西
                        if (self.BGisHave[BGW - 2][BGH - 1].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 2][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 2][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) - 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 2][BGH - 1][i].rotation % 360) == 270) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 2][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 2][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 2][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }



                                    break;
                                }

                            }

                        }
                        //右面那块有东西
                        if (self.BGisHave[BGW - 1][BGH].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) - 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH][i].rotation % 360) == 270) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        console.log(self.AllCorrectArray);
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                console.log("awwaa,," + this.node.name);
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);
                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }


                                    break;
                                }

                            }

                        }
                        //上面那块有东西
                        if (self.BGisHave[BGW][BGH - 1].length > 0) {
                            console.log("有人");

                            for (let i = 0; i < self.BGisHave[BGW][BGH - 1].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW][BGH - 1][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0])) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]) + 1)) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW][BGH - 1][i].rotation % 360) == 270) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW][BGH - 1][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW][BGH - 1][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW][BGH - 1][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }


                                    break;
                                }
                            }
                        }
                        //左面那块有东西
                        if (self.BGisHave[BGW - 1][BGH - 2].length > 0) {
                            console.log("有人");
                            for (let i = 0; i < self.BGisHave[BGW - 1][BGH - 2].length; i++) {
                                console.log(this.node);
                                if (self.BGisHave[BGW - 1][BGH - 2][i].getChildByName("New Label").getComponent(cc.Label).string == (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[0]) + 1) + "_" + (Number(this.node.getChildByName("New Label").getComponent(cc.Label).string[2]))) {
                                    console.log("对的人");
                                    if (Math.floor(self.BGisHave[BGW - 1][BGH - 2][i].rotation % 360) == 270) {
                                        console.log("又对了兄弟");
                                        var targetIn = false;
                                        var targetAround = false;
                                        for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                            for (let j = 0; j < self.AllCorrectArray[k].length; j++) {

                                                if (self.AllCorrectArray[k][j] == this.node) {
                                                    targetIn = true;
                                                }

                                                if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                    targetAround = true;
                                                }

                                            }
                                        }
                                        if (targetIn == false && targetAround == false) {
                                            self.AllCorrectArray.push([this.node, self.BGisHave[BGW - 1][BGH - 2][i]]);
                                        }
                                        else if (targetIn == false && targetAround == true) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {
                                                        self.AllCorrectArray[k].push(this.node);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == false) {
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        self.AllCorrectArray[k].push(self.BGisHave[BGW - 1][BGH - 2][i]);
                                                        break;
                                                    }
                                                }

                                            }
                                        }
                                        else if (targetIn == true && targetAround == true) {
                                            console.log("全有小兄弟");
                                            var arrayIndex = 0;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    if (self.AllCorrectArray[k][j] == this.node) {
                                                        arrayIndex = k;
                                                    }
                                                }

                                            }
                                            console.log(arrayIndex);
                                            var complete = false;
                                            for (let k = 0; k < self.AllCorrectArray.length; k++) {
                                                console.log("awwaa,," + this.node.name);
                                                if (k == arrayIndex) {
                                                    continue;
                                                }
                                                for (let j = 0; j < self.AllCorrectArray[k].length; j++) {
                                                    console.log("sdfvvvv,," + this.node.name);

                                                    if (self.AllCorrectArray[k][j] == self.BGisHave[BGW - 1][BGH - 2][i]) {

                                                        for (let m = 0; m < self.AllCorrectArray[k].length; m++) {
                                                            console.log("ssccbttt,," + this.node.name);
                                                            if (self.AllCorrectArray[arrayIndex].indexOf(self.AllCorrectArray[k][m]) == -1) {
                                                                self.AllCorrectArray[arrayIndex].push(self.AllCorrectArray[k][m]);
                                                                console.log(self.AllCorrectArray[arrayIndex]);
                                                            }
                                                        }
                                                        complete = true;
                                                        setTimeout(() => {
                                                            self.AllCorrectArray[k].splice(0, self.AllCorrectArray[k].length);
                                                        }, 200);

                                                        break;
                                                    }

                                                }
                                                if (complete) {
                                                    break;
                                                }

                                            }

                                        }
                                        console.log(self.AllCorrectArray);
                                    }
                                    break;
                                }

                            }

                        }
                    }
                }
            }
        }
    },
    // JudgeIsHaveKernel() {

    // },
    update(dt) {



    },
});
